# 文件    ： ai-download.py
# 时间    ： 2025/3/21 13:06
# 作者    ： Luzhaohui
# 环境    ： PyCharm

# 下载模型
from modelscope.hub.snapshot_download import snapshot_download
from tool.vars import *

def downLoadModel(model):
    # 下载大模型
    # 定义目标目录
    target_directory = '%s/%s' % (AIMODELDIR, model)
    # 指定要下载的模型ID
    model_id = model
    # 下载模型
    download_path = snapshot_download(model_id, local_dir=target_directory)
    return download_path


if __name__ == '__main__':
    if AIMODELDIR == None:
        print('system error')
        exit(-1)
    print('modescope download test')
    # deepseek-vl2
    # model = "deepseek-ai/deepseek-vl2"
    # model = "deepseek-ai/deepseek-vl2-tiny"
    # model = "deepseek-ai/deepseek-vl2-small"

    # Qwen2.5
    # model = 'Qwen/Qwen2.5-72B-Instruct'
    # model = 'Qwen/Qwen2.5-32B-Instruct'
    # model = 'Qwen/Qwen2.5-14B-Instruct'
    # model = 'Qwen/Qwen2.5-7B-Instruct'
    # model = 'Qwen/Qwen2.5-3B-Instruct'
    # model = 'Qwen/Qwen2.5-1.5B-Instruct'

    # Qwen3-VL
    model = 'Qwen/Qwen3-VL-8B-Instruct'
    # model = 'Qwen/Qwen3-VL-4B-Instruct'
    # model = 'Qwen/Qwen3-VL-30B-A3B-Instruct'

    # Qwen2.5-VL
    # model = 'Qwen/Qwen2.5-VL-72B-Instruct'
    # model = 'Qwen/Qwen2.5-VL-32B-Instruct'
    # model = 'Qwen/Qwen2.5-VL-7B-Instruct'
    # model = 'Qwen/Qwen2.5-VL-3B-Instruct'

    # Qwen2.5-Omni
    # model = 'Qwen/Qwen2.5-Omni-7B'
    # model = 'Qwen/Qwen2.5-Omni-3B'

    # Qwen2.5-VL AWQ
    # model = 'Qwen/Qwen2.5-VL-72B-Instruct-AWQ'
    # model = 'Qwen/Qwen2.5-VL-32B-Instruct-AWQ'
    # model = 'Qwen/Qwen2.5-VL-7B-Instruct-AWQ'
    # model = 'Qwen/Qwen2.5-VL-3B-Instruct-AWQ'

    # model = 'XiaomiMiMo/MiMo-VL-7B-SFT'
    # model = 'XiaomiMiMo/MiMo-VL-7B-RL'

    # Qwen2-VL
    # model = 'Qwen/Qwen2-VL-72B-Instruct'
    # model = 'Qwen/Qwen2-VL-7B-Instruct'
    # model = 'Qwen/Qwen2-VL-2B-Instruct'

    # Qwen2-VL AWQ
    # model = 'Qwen/Qwen2-VL-72B-Instruct-AWQ'
    # model = 'Qwen/Qwen2-VL-7B-Instruct-AWQ'
    # model = 'Qwen/Qwen2-VL-2B-Instruct-AWQ'

    # InternVL3
    # model = 'OpenGVLab/InternVL3-1B'
    # model = 'OpenGVLab/InternVL3-1B-Instruct'
    # model = 'OpenGVLab/InternVL3-2B'
    # model = 'OpenGVLab/InternVL3-2B-Instruct'
    # model = 'OpenGVLab/InternVL3-8B'
    # model = 'OpenGVLab/InternVL3-8B-Instruct'
    # model = 'OpenGVLab/InternVL3-9B'
    # model = 'OpenGVLab/InternVL3-9B-Instruct'
    # model = 'OpenGVLab/InternVL3-14B'
    # model = 'OpenGVLab/InternVL3-14B-Instruct'
    # model = 'OpenGVLab/InternVL3-38B'
    # model = 'OpenGVLab/InternVL3-38B-Instruct'

    # Qwen3
    # model = 'Qwen/Qwen3-0.6B'
    # model = 'Qwen/Qwen3-1.7B'
    # model = 'Qwen/Qwen3-4B'
    # model = 'Qwen/Qwen3-8B'
    # model = 'Qwen/Qwen3-14B'
    # model = 'Qwen/Qwen3-32B'
    # model = 'Qwen/Qwen3-30B-A3B'

    # yolo
    # model = 'AI-ModelScope/YOLO11'
    # model = 'yolo_master/YOLO11'
    # model = 'yolo_master/YOLO12'

    # MiniCPM
    # model = 'OpenBMB/MiniCPM-V-2_6'
    # model = 'OpenBMB/MiniCPM-V-2_6-int4'
    # model = 'AI-ModelScope/MiniCPM-V-2_6'

    # Real-ESRGAN
    # model = 'AI-ModelScope/Real-ESRGAN'
    # model = 'ai-forever/Real-ESRGAN'

    # Ocr
    # 读光-文字识别-行识别模型-中英-手写文本领域
    # model = 'iic/cv_convnextTiny_ocr-recognition-handwritten_damo'
    # 读光-文字识别-行识别模型-中英-领域
    # model = 'iic/cv_convnextTiny_ocr-recognition-general_damo'
    # 读光-表格结构识别-有线表格
    # model = 'iic/cv_dla34_table-structure-recognition_cycle-centernet'
    # 读光-表格结构识别-无线表格
    # model = 'iic/cv_resnet-transformer_table-structure-recognition_lore'
    # model = 'RapidAI/RapidOCR'
    # model = 'lsmodel/ocr_model'
    # model = 'PaddlePaddle/PaddleOCR-VL'

    path = downLoadModel(model)
    print(f"Model downloaded to: {path}")
